/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.templates.commands.ManualDrive;

/**
 *
 * @author Jarrod Risley
 */
public class DriveSubsystem extends Subsystem {
    // Put methods for controlling this subsystem
    // here. Call these from Commands.

    /*
     * Global Variables
     */
    private Jaguar motors[] = new Jaguar[3];
    private String subsystemName;
    
    /**
     * Sets the default command. The default for this subsystem is ManualDrive();
     */
    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
        
        setDefaultCommand(new ManualDrive());
        
    } // end initDefaultComand
    
    
    // CONSTRUCTOR //
    
    
    /**
     * Creates one side of the robot's drivetrain. Use values from RobotMap
     * for the motor ID's.
     * 
     * @param name Name of the subsystem.
     * @param motor1 First Motor
     * @param motor2 Second Motor
     * @param motor3 Third Motor
     */
    
    public DriveSubsystem(String name, int motor1, int motor2, int motor3) {
        
        subsystemName = name;
        
        System.out.println("Creating DriveSubsystem " + subsystemName);
        
        motors[0] = new Jaguar(motor1);
        motors[1] = new Jaguar(motor2);
        motors[2] = new Jaguar(motor3);
        
    } // end DriveSubsystem Constructor
    
    
    // METHODS //
    
    /**
     * Default motor movement method. Use this to move the motors in the 
     * subsystem.
     * 
     * @param value A joystick value from -1.0 to 1.0.
     */
    public void driveMotors(double value) {
        
        for (int z = 0; z < motors.length; z++) {
            motors[z].set(value);
        } // end for
        
    } // end driveMotors
    
    
    
} // DriveSubsystem
